{% extends "test.html" %}
{% import "_macros.html" as mr%}

{% block title%}
<h3>博客广场</h3>
<p>这注定是一个不同寻常的时刻</p>
{% endblock %}
{% block post %}
<div class="col-lg-9">
    {% for post in posts %}

    <div class="blog_main_item" shadow="hover">
        <div class="blog_img">
            {% if post.img == None%}
            <img class="img-fluid" src="{{url_for('static',filename='img/blog/blog-2.jpg')}}" alt="">
            {% else %}
            <img class="img-fluid" src="{{url_for('static',filename=post.img)}}" alt="">
            {% endif%}

        </div>
        <div class="blog_text">
            <a href="{{url_for('posts',id=post.id)}}"><h4>{{post.tittle}}</h4></a>
            <div class="blog_author">
                <a href="{{url_for('profileid',username=post.role.username)}}">作者:{{post.role.username}}</a>
                <a>{{post.addtime}}</a>
            </div>
            <div class="blog_author">
                <p>{% if post.body_html %}
                {{ post.body_html |safe|striptags|truncate }}
            {% else %}
                {{ post.body }}
            {% endif %}
</p>
            </div>
            <div class="blog_allin_foot">
            <div class="blog_text_li">
                <a href="{{url_for('like',id=post.id)}}">点赞</a>
  <i class="fa fa-thumbs-o-up" aria-hidden="true"> ：</i>{{post.likes.count()}}
            </div>
            <div class="blog_text_li">
                <a href="{{url_for('like',id=post.id)}}">评论</a>
<i class="fa fa-commenting-o" aria-hidden="true"> ：</i>{{post.comments.count()}}
            </div>
            <div class="blog_text_li">
                <a href="{{url_for('posts',id=post.id)}}">浏览</a>
  <i class="fa fa-street-view" aria-hidden="true"> ：</i>{{post.view}}
            </div>
            </div>
        </div>
    </div>
    {%endfor%}

    {{ mr.pagination_widget(article,'index')}}
</div>
{% endblock %}

